Забанов Александр
xxxxxxxxxxnamespace Tests\Unit;use PHPUnit\Framework\TestCase;class ExampleTest extends TestCase{ public function test_that_true_is_true(): void { $this->assertTrue(true); }}x
test('true is true', function () { expect(true)->toBeTrue();});

x
./vendor/bin/pest --drift
x
./vendor/bin/pest
x
./vendor/bin/pest --parallel
├── 📂 tests │ ├── 📂 Unit │ │ └── ExampleTest.php │ └── 📂 Feature │ │ └── ExampleTest.phpL │ └── TestCase.php │ └── Pest.php ├── phpunit.xml
xxxxxxxxxxerror_reporting(E_ALL);// pest()->extend(Tests\TestCase::class)->in('Feature');pest()->project()->gitlab('webpractik/pochtabank.ru');

xxxxxxxxxxpublic TestedMethod_Script_ExpectedResult()xxxxxxxxxxtest(‘Any text’, function () { expect(true)->toBeTrue();});x
uses()->group('unit');x
./vendor/bin/pest --group=unitx
it('has home', function () { // })->skip(); //->skip('The kvadrober doesn't have a home yet'); //->skip($condition == true, 'The kvadrober doesn't have a home yet'); //->skipOnWindows(); // or skipOnMac() or skipOnLinux() ... //->skipOnPhp('>=8.0.0');x
beforeEach(function () { // Подготовьте что-нибудь перед каждым тестовым запуском... }); afterEach(function () { // Очищайте данные тестирования после каждого тестового запуска.... }); beforeAll(function () { // Подготовьте что-нибудь перед запуском любого из тестов этого файла... }); afterAll(function () { // Очистите данные тестирования после всех проведенных тестов... });xxxxxxxxxxuse App\Repositories\AnimalFeedRepository;use Mockery;it('may buy a pet food', function () { $client = Mockery::mock(KvadroberClient::class); $client->shouldReceive('post'); $books = new AnimalFeedRepository($client); $books->buy(); // API на самом деле не вызывается, поскольку `$client->post()` был имитирован...});xxxxxxxxxxexpect($user) ->name->toBe('James') ->surname->toBe('Bond') ->addTitle('Mr.')->toBe('Mr. James Bond');xxxxxxxxxxarch() ->expect('App') ->toUseStrictTypes() ->not->toUse(['die', 'dd', 'dump']); arch() ->expect('App\Models') ->toBeClasses() ->toOnlyBeUsedIn('App\Repositories') ->ignoring('App\Models\Kvadrobers'); arch() ->expect('App\Http') ->toOnlyBeUsedIn('App\Http');x
arch()->preset()->php();arch()->preset()->security();arch()->preset()->laravel();x
composer require pestphp/pest-plugin-stressless --dev# Запуск./vendor/bin/pest stress Kvadrober.comx
// Кол-во одновременных запросов 2, длителность 5$result = stress('Kvadrober.com')->concurrently(requests: 2)->for(5)->seconds();// В любой момент вы можете просмотреть dd$result = stress('Kvadrober.com')->dd();// $result = stress('Kvadrober.com')->dump();// $result = stress('Kvadrober.com')->verbosely();
x
./vendor/bin/pest --type-coverage# форматы--type-coverage-json=my-report.json
Пример: pa31 означает, что отсутствует тип параметра функции в строке 31
xxxxxxxxxx./vendor/bin/pest --mutate# or in parallel..../vendor/bin/pest --mutate --parallelxxxxxxxxxxit('has a contact page', function () { $response = $this->get('/contact'); expect($response)->toMatchSnapshot();});xxxxxxxxxxexpect()->pipe('toMatchSnapshot', function (Closure $next) { if (is_string($this->value)) { $this->value = preg_replace( '/name="_token" value=".*"/', 'name="_token" value="my_test"', $this->value ); } return $next();});xxxxxxxxxxit('has a contact page', function () { //})->todo();// Просмотреть отдельно./vendor/bin/pest --todosxxxxxxxxxxit('has a contact page', function () { //})->todo(assignee: 'DeadLarsen');//Используем флаг --assignee./vendor/bin/pest --todos --assignee=DeadLarsenxxxxxxxxxxit('has a contact page', function () { // })->todo(pr: 123);// Флаг --pr./vendor/bin/pest --todos --pr=123xxxxxxxxxxit('has a contact page', function () { //})->todo(issue: 123);// Флаг --issue./vendor/bin/pest --todos --issue=123xxxxxxxxxxit('has a contact page', function () { //})->todo(note: <<<NOTE Given I am a user When I visit the contact page Then I should see a contact formNOTE);xxxxxxxxxxdescribe('contacts', function () { it('has a contact page', function () { // }))->issue(123); // or ->pr(123) etc it('has a contact form', function () { // })->done(pr: 567);})->wip(assignee: 'DeadLarsen');

______ __ __
/\__ _\/\ \ /\ \
\/_/\ \/\ \ \___ __ __ ___ \_\ \
\ \ \ \ \ _ `\ /'__`\ /'__`\ /' _ `\ /'_` \
\ \ \ \ \ \ \ \ /\ __/ /\ __/ /\ \/\ \ /\ \L\ \
\ \_\ \ \_\ \_\\ \____\ \ \____\\ \_\ \_\\ \___,_\
\/_/ \/_/\/_/ \/____/ \/____/ \/_/\/_/ \/__,_ /